<html>
<head>
    <!-- 引用javascript -->
    <script src="http://localhost:3999/static/checkPayment.js"></script>
</head>
<body>
<div class="title">
    <!-- 添加一个id="productId" -->
    <h2><span id="productId"> What The Duck</span></h2>
</div>
<!-- 以下插入<div class="description">...|</div>的最后（即|这个位置） -->
<div id="payment-container"></div>
<script>
    document.addEventListener('DOMContentLoaded', async () => {
        const paymentContainer = document.getElementById('payment-container');
        var productId = document.getElementById('productId').innerText;
        // 调用后端接口
        var orderNo = generateOrderNo(productId);
        const response = await fetch(`http://localhost:3999/create-order/${orderNo}`);
        if (response.ok) {
            const htmlContent = await response.text();
            paymentContainer.innerHTML = htmlContent; // 将返回的HTML内容渲染到指定的div中
        } else {
            paymentContainer.innerHTML = `<p>加载失败，请稍后再试。</p>`;
        }
    });
</script>
</body>

</html>
